﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CarCostEdit.aspx.cs" Inherits="Webcar.Car.CarCostEdit" %>
<%@ Register Src="../Controls/NaviBar.ascx" TagName="NaviBar" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>单车月成本编辑</title>
</head>
<script language = "javaScript" src ="../JavaScript/default.js" type="text/javascript"></script>
<body>
       <form id="form1" runat="server">
    <div class="TableEdit" >
        <div class="content" >
        
            <uc1:NaviBar ID="NaviBar1" runat="server" />
            <br />
            <div class="tips">
                <span>提示:带*号的项目必须录入</span>
                </div>
            <br />
            <table id = "t" cellspacing="1" cellpadding="1" border="0">
                <tr class="tableAlterItems">
                    <td class="tdleft" >
                        *牌照号：</td>
                    <td class="tdright">
                        <asp:TextBox ID="tbRecordNo"  onblur="lostfocus();lostfocus2();" Width="97%" runat="server"></asp:TextBox></td>
                    <td class="tdleft" >
                        车型：</td>
                    <td class="tdright">
                        <asp:TextBox ID="tbCarClassName" runat="server" Width="97%" Enabled="False"></asp:TextBox></td>
                </tr>
                <tr class="tableAlterItems">
                    <td class="tdleft" >
                        *所属单位：</td>
                    <td class="tdright">
                        <asp:DropDownList ID="ddlDept" Width="100%" runat="server">
                        </asp:DropDownList></td>
                    <td class="tdleft" >
                        *月份：</td>
                    <td class="tdright">
                        <asp:TextBox ID="tbMonth" runat="server" Width="97%" onblur="javascript:lostfocus2();" ></asp:TextBox></td>
                </tr>
                <tr class="tableAlterItems">
                    <td class="tdleft" >
                        住宿费：</td>
                    <td class="tdright">
                        <asp:TextBox ID="tbZsFee" runat="server" Width="97%"></asp:TextBox></td>
                    <td class="tdleft" >
                        差旅费：</td>
                    <td class="tdright">
                        <asp:TextBox ID="tbClfee"  Width="97%" runat="server"></asp:TextBox></td>
                </tr>
                <tr class="tableAlterItems">
                    <td class="tdleft" >
                        路桥费：</td>
                    <td class="tdright" >
                        <asp:TextBox ID="tbLqfee" Width="97%" runat="server"></asp:TextBox></td>
                    <td class="tdleft"  >
                        洗车费：</td>
                    <td class="tdright" >
                        <asp:TextBox ID="tbXcfee" Width="97%"  runat="server"></asp:TextBox></td>
                </tr>
                <tr class="tableAlterItems">
                    <td class="tdleft"   >
                        停车费：</td>
                    <td >
                        <asp:TextBox ID="tbTcfee" runat="server" Width="97%"></asp:TextBox></td>
                    <td class="tdleft"  >
                        年审费：</td>
                    <td >
                        <asp:TextBox ID="tbNsFee" runat="server" Width="97%"></asp:TextBox></td>
                </tr>
                <tr class="tableAlterItems">
                    <td class="tdleft"   >
                        路桥年票：</td>
                    <td >
                        <asp:TextBox ID="tbYearFee" runat="server" Width="97%"></asp:TextBox></td>
                    <td class="tdleft"   >
                        路桥月票：</td>
                    <td >
                        <asp:TextBox ID="tbMonthFee" runat="server" Width="97%"></asp:TextBox></td>
                </tr>
                    <tr class="tableAlterItems">
                    <td class="tdleft"   >
                        养路费：</td>
                    <td >
                        <asp:TextBox ID="tbRoadFee" runat="server" Width="97%"></asp:TextBox></td>
                    <td class="tdleft"   >
                        其他费用：</td>
                    <td >
                        <asp:TextBox ID="tbOtherFee" runat="server" Width="97%"></asp:TextBox></td>
                </tr>
                <tr class="tableAlterItems">
                    <td class="tdleft"  >
                        本月耗油量：</td>
                    <td align="left" >
                        <asp:TextBox ID="tbOilNum" Width="34%" runat="server"></asp:TextBox>&nbsp;油料单价：<asp:TextBox
                            ID="tbOilPrice" runat="server" Width="32%"></asp:TextBox></td>
                        <td class="tdleft"   >
                            油料费：</td>
                    <td >
                        <asp:TextBox ID="tbOilFee" runat="server" Width="97%"></asp:TextBox></td>
                </tr>
            </table>
            <br />
            <div class="footer">
                <div class="e">
                    <asp:Label ID="lblInfo" runat="server" ForeColor="Blue" Text=""></asp:Label>
                    <hr class="line_blue" />
                    <asp:Label ID="lblError" runat="server"></asp:Label>
                </div>
                <span style="color: red">保存后点击下一页的&lt;返回&gt;可以继续录入</span>。&nbsp;
                <asp:Button ID="btnSave" runat="server" Text="保存数据" SkinID="default_button" Width="60px" OnClick="btnSave_Click"/>
                 <input id="Button2" type="button" value="返回" style="width:60px" class="button" onclick="javascript:history.back(1);" />
                 </div>
        </div>
    </div>
    </form>
</body>
</html>
<script language="javascript">
function lostfocus()
{
//触发button1的事件，得到用户名
    var recordno = document.getElementById("tbRecordNo").value;
	if(recordno=="")
		return;
	var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
	xmlHttp.open("GET", "../ajax.ashx?type=carcost&key="+escape(recordno), false);
	xmlHttp.send();
	var re=xmlHttp.responseText;
	
	if(re=="NULL")
	{
	    document.getElementById("tbCarClassName").value = "该车辆不存在。"
	    return;
	}
	var str = re.split(",");
	if(SelectOptionsExists(document.getElementById("ddlDept"),str[0]))
	    document.getElementById("ddlDept").value = str[0];
	    
	if(str[1]==undefined)
	    return;
	document.getElementById("tbCarClassName").value = str[1];
    
    
	
	
}
function lostfocus2()
{
    var recordno = document.getElementById("tbRecordNo").value;
	if(recordno=="")
		return;
	
    var ny = document.getElementById("tbMonth").value;
    var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
    xmlHttp.open("GET", "../ajax.ashx?type=oil&key="+escape(recordno)+"&key2="+ny, false);
	xmlHttp.send();
	document.getElementById("tbOilNum").value = xmlHttp.responseText;
	
}
</script>